﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace GPCSC.Web.CL_Menu_S
{
    public partial class Modify : Page
    {       

        		protected void Page_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack)
			{
				#warning 代码生成提示：显示页面,请检查确认该语句是否正确
				ShowInfo();
			}
		}
			
	private void ShowInfo()
	{
		GPCSC.BLL.CL_Menu_S bll=new GPCSC.BLL.CL_Menu_S();
		GPCSC.Model.CL_Menu_S model=bll.GetModel();
		this.lblCL_Menu_SOID.Text=model.CL_Menu_SOID.ToString();
		this.txtMenuName.Text=model.MenuName;
		this.txtNavigateUrl.Text=model.NavigateUrl;
		this.txtMenuNum.Text=model.MenuNum.ToString();
		this.txtDEPTH.Text=model.DEPTH.ToString();
		this.txtREMARK.Text=model.REMARK;
		this.txtTARGET.Text=model.TARGET;
		this.txtIconUrl.Text=model.IconUrl;
		this.lblCL_PARMenuID_PK.Text=model.CL_PARMenuID_PK.ToString();
		this.txtPARMenuName.Text=model.PARMenuName;
		this.txtNumber.Text=model.Number.ToString();

	}

		public void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtMenuName.Text.Trim().Length==0)
			{
				strErr+="MenuName不能为空！\\n";	
			}
			if(this.txtNavigateUrl.Text.Trim().Length==0)
			{
				strErr+="NavigateUrl不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtMenuNum.Text))
			{
				strErr+="MenuNum格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtDEPTH.Text))
			{
				strErr+="DEPTH格式错误！\\n";	
			}
			if(this.txtREMARK.Text.Trim().Length==0)
			{
				strErr+="REMARK不能为空！\\n";	
			}
			if(this.txtTARGET.Text.Trim().Length==0)
			{
				strErr+="TARGET不能为空！\\n";	
			}
			if(this.txtIconUrl.Text.Trim().Length==0)
			{
				strErr+="IconUrl不能为空！\\n";	
			}
			if(this.txtPARMenuName.Text.Trim().Length==0)
			{
				strErr+="PARMenuName不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtNumber.Text))
			{
				strErr+="Number格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			Guid CL_Menu_SOID= new Guid(this.lblCL_Menu_SOID.Text);
			string MenuName=this.txtMenuName.Text;
			string NavigateUrl=this.txtNavigateUrl.Text;
			int MenuNum=int.Parse(this.txtMenuNum.Text);
			int DEPTH=int.Parse(this.txtDEPTH.Text);
			string REMARK=this.txtREMARK.Text;
			string TARGET=this.txtTARGET.Text;
			string IconUrl=this.txtIconUrl.Text;
			Guid CL_PARMenuID_PK= new Guid(this.lblCL_PARMenuID_PK.Text);
			string PARMenuName=this.txtPARMenuName.Text;
			int Number=int.Parse(this.txtNumber.Text);


			GPCSC.Model.CL_Menu_S model=new GPCSC.Model.CL_Menu_S();
			model.CL_Menu_SOID=CL_Menu_SOID;
			model.MenuName=MenuName;
			model.NavigateUrl=NavigateUrl;
			model.MenuNum=MenuNum;
			model.DEPTH=DEPTH;
			model.REMARK=REMARK;
			model.TARGET=TARGET;
			model.IconUrl=IconUrl;
			model.CL_PARMenuID_PK=CL_PARMenuID_PK;
			model.PARMenuName=PARMenuName;
			model.Number=Number;

			GPCSC.BLL.CL_Menu_S bll=new GPCSC.BLL.CL_Menu_S();
			bll.Update(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","list.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
